#ifndef DATABASE_DATA_ROLE_MENU_ITEM_H
#define DATABASE_DATA_ROLE_MENU_ITEM_H

#include "common/elements/element.h"

#include "data_element.h"

namespace Database
{

struct DataRoleMenuItem final : public DataElement
{
    // Основной интерфейс ------------------------------------------------------

    explicit DataRoleMenuItem(Elements::Element* element = nullptr);
    explicit DataRoleMenuItem(std::shared_ptr<Elements::Element> element);
    explicit DataRoleMenuItem(sqlite::database& database, unsigned id);

    virtual DataElement* clone() const override;
    virtual DataElement* wrap(Elements::Element* element) const override;

    virtual void toDatabase(sqlite::database& database) override;
    virtual void fromDatabase(sqlite::database& database, unsigned id) override;

    virtual std::vector<Elements::Element*> fromDatabaseElements(
        sqlite::database& database,
        std::vector<unsigned> ids
    ) const override;

    // Получение идентификаторов -----------------------------------------------

    static std::vector<unsigned> ids(
        sqlite::database& database
    );

    // Удаление ----------------------------------------------------------------

    static void removeOne(sqlite::database& database, unsigned id);
    static void remove(sqlite::database& database, std::vector<unsigned> ids);
};

typedef std::shared_ptr<DataRoleMenuItem> DataRoleMenuItemPtr;
typedef std::vector<DataRoleMenuItemPtr> DataRoleMenuItems;

} // namespace Elements

#endif // DATABASE_DATA_ROLE_MENU_ITEM_H
